package types

//"required"` //非空
//"gte=0,lte=130"` //  0<=Age<=130
//"required,email"` //非空，email格式
//"required"` //非空
//"numeric,len=11"` //数字类型，长度为11

// ReqAuthRule 菜单权限.
type ReqAuthRule struct {
	Id         int64  `form:"id" json:"id"`
	Type       int    `form:"type" json:"type"`
	Pid        int64  `form:"pid" json:"pid"`
	Title      string `form:"title" json:"title"`
	AuthRule   string `form:"auth_rule" json:"auth_rule"`
	RouterName string `form:"router_name" json:"router_name"`
	RouterPath string `form:"router_path" json:"router_path"`
	Path       string `form:"path" json:"path"`
	Method     string `form:"method" json:"method"`
	Icon       string `form:"icon" json:"icon"`
	Weigh      int    `form:"weigh" json:"weigh"`
	AuthCode   string `form:"authCode" json:"auth_code"`
	Remark     string `form:"remark" json:"remark"`
	Extend     string `form:"extend" json:"extend"`
	KeepAlive  bool   `form:"keep_alive" json:"keep_alive"`
}

// ReqAddUser 添加用户.
type ReqAddUser struct {
	UserName   string       `form:"user_name" json:"user_name" binding:"required"`
	NickName   string       `form:"nick_name" json:"nick_name"`
	PassWord   string       `form:"pass_word" json:"pass_word" binding:"required"`
	UserType   int          `form:"user_type" json:"user_type"`
	Email      string       `form:"email" json:"email"`
	Phone      string       `form:"phone" json:"phone"`
	FixedPhone string       `gorm:"type:varchar(16);default:''" json:"fixed_phone"` // 固话
	Facsimile  string       `gorm:"type:varchar(16);default:''" json:"facsimile"`   // 传真
	ExpireTime string       `json:"expire_time"`                                    // 密码过期时间
	Desc       string       `gorm:"type:varchar(64);default:''"json:"desc"`         // 描述
	UserGroups []UserGroups `json:"user_group"`
}

// UserGroups 组和角色.
type UserGroups struct {
	GroupId int64 `json:"group_id" form:"group_id"`
	RoleId  int64 `json:"role_id" form:"role_id"`
}

// ReqUpdateUser 更新用户.
type ReqUpdateUser struct {
	ID         int64        `form:"id" json:"id" binding:"required"`
	UserName   string       `form:"user_name" json:"user_name"`
	NickName   string       `form:"nick_name" json:"nick_name"`
	PassWord   string       `form:"pass_word" json:"pass_word"`
	UserType   int          `form:"user_type" json:"user_type"`
	Status     int          `json:"status"form:"status"`
	Email      string       `form:"email" json:"email"`
	Phone      string       `form:"phone" json:"phone"`
	FixedPhone string       `form:"fixed_phone"  json:"fixed_phone"` // 固话
	Facsimile  string       `form:"facsimile" json:"facsimile"`      // 传真
	ExpireTime string       `json:"expire_time" form:"expire_time"`  // 密码过期时间
	Desc       string       `form:"desc"json:"desc"`                 // 描述
	UserGroups []UserGroups `form:"user_group" json:"user_group"`
}

type ReqId struct {
	ID int64 `form:"id" json:"id" binding:"required"`
}

type BasePage struct {
	Page int `form:"page" json:"page" binding:"required,gt=0"`
	Size int `form:"size" json:"size" binding:"required,lte=1000"` // gte=0,lte=130
}

// ReqFindUser 查询用户.
type ReqFindUser struct {
	GroupId  int64  `form:"group_id"json:"group_id" `
	UserName string `form:"user_name"json:"user_name"`
	BasePage
}

// ReqGetUserRole 用户角色.
type ReqGetUserRole struct {
	Uid int64 `json:"uid"form:"uid" binding:"required"`
}

// ReqGetUserGroup 获取用户组.
type ReqGetUserGroup struct {
	Uid int64 `json:"uid"form:"uid" binding:"required"`
}

// ReqStation 站点列表.
type ReqStation struct {
	GroupId int64  `form:"group_id" json:"group_id"`
	Uuid    string `form:"uuid" json:"uuid"`
	SName   string `form:"s_name" json:"s_name"`
	BasePage
}

// ReqEditGroupStation 编辑用户组站点.
type ReqEditGroupStation struct {
	GroupId    int64    `json:"group_id" binding:"required" form:"group_id"`
	StationIds []string `json:"station_ids" binding:"required" form:"station_ids"`
}

// EditUsesGroup 编辑用户组.
type EditUsesGroup struct {
	Uid        int64        `json:"uid" form:"uid" validate:"required"`
	UserGroups []UserGroups `json:"user_groups" form:"user_groups"`
}

// ReqResetPwd 重置密码.
type ReqResetPwd struct {
	Id  int64  `json:"id" form:"id" validate:"required"`
	Pwd string `json:"pwd" form:"pwd" validate:"required"`
}

type ReqChangePwd struct {
	Pwd    string `json:"pwd" form:"pwd" validate:"required"`
	NewPwd string `json:"new_pwd" form:"new_pwd" validate:"required"`
}

type ReqAddCompany struct {
	RoleId   int64  `json:"role_id" form:"role_id"`
	UserName string `json:"user_name" form:"user_name" validate:"required"`
	PassWord string `json:"pass_word" form:"pass_word" validate:"required"`
	Company
}

type Company struct {
	Name    string `json:"name" form:"name" validate:"required"`
	IconImg string `json:"icon_img" form:"icon_img"`
	Remarks string `json:"remarks" form:"remarks"`
}

type ReqUpdateCompany struct {
	ReqId
	Name    string `json:"name" form:"name"`
	IconImg string `json:"icon_img" form:"icon_img"`
	Remarks string `json:"remarks" form:"remarks"`
}

type ReqMenu struct {
	GroupId int64 `json:"group_id" form:"group_id"`
}

type ReqOperation struct {
	BasePage
	LogType   string `json:"log_type" form:"log_type"`
	StartDate string `json:"start_date" form:"start_date"`
	EndDate   string `json:"end_date" form:"end_date"`
}
